package com.cn.serverline.lineicp.produce.controller;


import com.cn.serverline.lineicp.produce.entity.dto.PlanDetailsDTO;
import com.cn.serverline.lineicp.produce.entity.dto.PlanRequestDTO;
import com.cn.serverline.lineicp.produce.entity.vo.PlanDetailsVO;
import com.cn.serverline.lineicp.produce.entity.vo.PlanDetailsbVO;
import com.cn.serverline.lineicp.produce.entity.vo.StopDurationInfoVo;
import com.cn.serverline.lineicp.produce.entity.vo.TasksByLotNoVo;
import com.cn.serverline.lineicp.produce.service.IStepRequiredService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 生产执行追溯页 前端控制器
 * </p>
 *
 * @author 王烁
 * @since 2024-08-12
 */
@Api(tags = "生产执行追溯页")
@RestController
@RequestMapping("/teStepRequired")
public class StepRequiredController {

    @Autowired
    private IStepRequiredService stepRequiredService;

    @ApiOperation(value = "获取生产执行追溯页 第一个列表数据")
    @GetMapping("/lot/{lotNo}")
    public List<TasksByLotNoVo> getTasksByLotNo(@ApiParam(value = "批次号") @PathVariable String lotNo) {
        return stepRequiredService.getTasksByLotNo(lotNo);
    }
    @ApiOperation(value = "获取生产执行追溯页 第二个列表数据")
    @GetMapping("/StepRequired/{lotNo}")
    public List<StopDurationInfoVo> getStopDurationInfo(@ApiParam(value="批次号")@PathVariable String lotNo) {
        return stepRequiredService.getStopDurationInfo(lotNo);
    }
    @ApiOperation(value = "获取生产执行追溯页 总装的叫料、下发id、工序id和名称的查询")
    @PostMapping("/details")
    public  List<HashMap<String, String>> getPlanDetails(@Valid @RequestBody PlanRequestDTO requestDTO) {
        return stepRequiredService.getPlanDetails(requestDTO);
    }
    @ApiOperation(value = "获取生产执行追溯页 部装的叫料、下发id、工序id和名称的查询")
    @PostMapping("/traceability")
    public Map<String, List<PlanDetailsbVO>> getProductionTraceabilityDetails(@Valid @RequestBody PlanDetailsDTO requestDTO) {
        return stepRequiredService.getProductionTraceabilityDetails(requestDTO);
    }
}
